package com.jh3502.vivo.function.author.chosen;

import android.view.View;
import android.widget.TextView;

import com.jh3502.vivo.R;
import com.jh3502.vivo.function.author.add.AuthorBean;
import com.jh3502.vivo.view.treeview.RootNode;
import com.jh3502.vivo.view.treeview.TreeNode;
import com.jh3502.vivo.view.treeview.TreeViewBinder;

public class RootViewBinder extends TreeViewBinder<RootViewBinder.ViewHolder> {


    @Override
    public int getLayoutId() {
        return R.layout.item_root;
    }

    @Override
    public int getToggleId() {
        return R.id.root_node;
    }

    @Override
    public int getCheckedId() {
        return 0;
    }

    @Override
    public int getClickId() {
        return R.id.root_parent;
    }


    @Override
    public ViewHolder creatViewHolder(View itemView) {
        return new ViewHolder(itemView);
    }

    @Override
    public void bindViewHolder(ViewHolder holder, int position, TreeNode treeNode) {
        String typename = ((AuthorBean) ((RootNode) treeNode.getValue()).getBean()).getTypename();
//        if(type==1){
//            ((TextView) holder.findViewById(R.id.root_name)).setText(typename);
//        }else if(type==2){
//            ((TextView) holder.findViewById(R.id.root_name)).setText("报销");
//        }
        ((TextView) holder.findViewById(R.id.root_name)).setText(typename);
        holder.findViewById(R.id.root_node).setRotation(treeNode.isExpanded() ? 180 : 0);
    }

    class ViewHolder extends TreeViewBinder.ViewHolder {

        public ViewHolder(View itemView) {
            super(itemView);
        }
    }
}
